<?php
    $listArticle1   = $listArticle2 = array();
    $checkShow      = false;
    if ( $this->arrArticle['total']>0 && !empty($this->arrArticle['list']) && is_array($this->arrArticle['list']) )
    {
        $checkShow      = true;
        $listArticle1   = array_slice($this->arrArticle['list'], 0, 1);
        $listArticle2   = array_slice($this->arrArticle['list'], 1);
    }//end if
?>
<div id="wrapper_container">
    <!-- InstanceBeginEditable name="Hot news option" -->
    <div class="banner_960 w960 mar_left_10"></div>
    <!-- InstanceEndEditable -->
    <div class="w980 left">
        <div id="col_left" class="w650 left pad_left_10">
            <!-- InstanceBeginEditable name="Content col left" -->
            <div class="box_content_left" id="baithi_moinhat">
                <div class="title bg_baithi">
                    <h2>
                    <?php
                        switch ( $this->categoryId )
                        {
                            case 3:
                                echo "Bài dự thi nổi bật";
                                $resultMessage  = "Chưa có bài dự thi nổi bật";
                                break;
                            case $this->categoryConfig['listteam']:
                                echo "Các câu lạc bộ tiêu biểu";
                                $resultMessage  = "Chưa có bài viết về các đội bóng";
                                break;
                            case $this->categoryConfig['eurohistory']:
                                echo "Bài viết về lịch sử euro";
                                $resultMessage  = "Chưa có bài viết về lịch sử euro";
                                break;
                            case $this->categoryConfig['none']:
                            default:
                                echo "Bài dự thi mới nhất";
                                $resultMessage  = "Chưa có bài dự thi";
                                break;
                        }//end switch
                    ?>
                    </h2>
                <?php if ( $checkShow ) {?>
                    <span>Hiển thị từ <?php echo $this->start;?> đến <?php echo $this->end;?> trong số <?php echo $this->arrArticle['total'];?> bài</span>
                <?php } else {?>
                    <span><?php echo $resultMessage;?></span>
                <?php }//end if?>
                </div>
            <?php if ( !empty($listArticle1) && is_array($listArticle1) ) {?>
                <div class="content bg_xam">
                    <h2 class="name"><a href="<?php echo $this->MakeUrlSite(1, array('title'=>$listArticle1[0]['title'], 'id'=>$listArticle1[0]['articleid']));?>" title="<?php echo $this->escape($listArticle1[0]['title']);?>"><?php echo $this->escape($listArticle1[0]['title']);?></a></h2>
                <?php if ( !empty($listArticle1[0]['image']) ) {?>
                    <a href="<?php echo $this->MakeUrlSite(1, array('title'=>$listArticle1[0]['title'], 'id'=>$listArticle1[0]['articleid']));?>" title="<?php echo $this->escape($listArticle1[0]['title']);?>"><img src="<?php echo UPLOAD_URL_CLUB.$listArticle1[0]['image'];?>" align="absmiddle" width="150" height="115" title="<?php echo $this->escape($listArticle1[0]['title']);?>" /></a>
                <?php }//end if?>
                    <div class="detail">
                        <?php echo Util_Truncate::truncateHTML($listArticle1[0]['content'], 400);?>
                    </div>
                    <div class="source">
                        <p>
                            <?php if ( $this->categoryId==$this->categoryConfig['none'] || $this->categoryId==3 ) {?>Gửi bởi: <a class="widget" href="<?php echo BANBE_URL;?>/<?php echo $listArticle1[0]['userid'];?>/profile" rel="FPTD_<?php echo $listArticle1[0]['userid'];?>?sub=45" target="_blank"></a> <ins>|</ins> <?php }//end if?><?php echo $this->DateTimeDiff($listArticle1[0]['creation_time']);?> <ins>|</ins>
                            <label><?php echo $listArticle1[0]['total_view'];?></label>
                            lượt xem <ins>|</ins>
                            <?php if ( $this->categoryId==$this->categoryConfig['none'] || $this->categoryId==3 ) {?>
                            <label><?php echo $listArticle1[0]['total_vote'];?></label> bình chọn
                            <?php } else {?>
                            <label><?php echo $listArticle1[0]['total_vote'];?></label> bình luận<?php }//end if?>
                        </p>
                    </div>
                </div>
            <?php }//end if?>
            </div>

        <?php if ( $checkShow ) {?>
            <div id="list_baithi">
            <?php if ( !empty($listArticle2) && is_array($listArticle2) ) {?>
                <div class="content">
                    <ul>
                    <?php foreach ( $listArticle2 as $key=>$row ) {?>
                        <li>
                        <?php if ( !empty($row['image']) ) {?>
                            <a href="<?php echo $this->MakeUrlSite(1, array('title'=>$row['title'], 'id'=>$row['articleid']));?>" title="<?php echo $this->escape($row['title']);?>"><img src="<?php echo UPLOAD_URL_CLUB.$row['image'];?>" align="absmiddle" width="100" height="77" title="<?php echo $this->escape($row['title']);?>" /></a>
                        <?php }//end if?>
                            <div class="info">
                                <p><a class="title" href="<?php echo $this->MakeUrlSite(1, array('title'=>$row['title'], 'id'=>$row['articleid']));?>"><?php echo $this->escape($row['title']);?></a></p>
                            <?php if ( $this->categoryId==$this->categoryConfig['none'] || $this->categoryId==3 ) {?>
                                <p>Gửi bởi: <a class="widget" href="<?php echo BANBE_URL;?>/<?php echo $row['userid'];?>/profile" rel="FPTD_<?php echo $row['userid'];?>?sub=45" target="_blank"></a> <ins>|</ins> <?php echo $this->DateTimeDiff($row['creation_time']);?></p>
                            <?php } else {?>
                                <p><?php echo $this->DateTimeDiff($row['creation_time']);?></p>
                            <?php }//end if?>
                                <?php echo Util_Truncate::truncateHTML($row['content'], 200);?>
                                <div class="xem_chon">
                                <?php if ( $this->categoryId==$this->categoryConfig['none'] || $this->categoryId==3 ) {?>
                                    <p><label><?php echo $row['total_view'];?></label> lượt xem <ins>|</ins> <label><?php echo $row['total_vote'];?></label> bình chọn</p>
                                <?php } else {?>
                                    <p><label><?php echo $row['total_view'];?></label> lượt xem <ins>|</ins> <label><?php echo $row['total_comment'];?></label> bình luận</p>
                                <?php }//end if?>
                                </div>
                            </div>
                        </li>
                    <?php }//end foreach?>
                    </ul>
                </div>
            <?php }//end if?>
            <?php if ( !empty($this->pagingHTML) ) {?>
                <div class="paging">
                    <?php echo $this->pagingHTML;?>
                </div>
            <?php }//end if?>
            </div>
        <?php }//end if?>
            <!-- InstanceEndEditable -->
        </div>
        
        <div id="col_right" class="w300 right pad_right_10">
            <!-- InstanceBeginEditable name="Content col Right" -->
            <?php
                if ( $this->scheduleOpen )
                {
                    $htmlBanner = '<div class="banner_300 pad_top_10">
                                    <a href="'.$this->MakeUrlSite(7, null).'"><img src="'.IMAGE_URL_CLUB.'/graphics/banner_2.jpg" align="absmiddle" /></a>
                                  </div>';
                }
                else
                {
                    $htmlBanner = '';
                }//end if
                
                switch ( $this->categoryId )
                {
                    case 3:
                        echo $htmlBanner;
                        echo $this->render('box/list_post_lastest.phtml');
                        break;
                    case $this->categoryConfig['listteam']:
                        //echo $this->render('box/list_euro_history.phtml');
                        echo $this->render('box/detail_right.phtml');
                        break;
                    case $this->categoryConfig['eurohistory']:
                        echo $this->render('box/list_team_expression.phtml');
                        break;
                    case $this->categoryConfig['none']:
                    default:
                        echo $htmlBanner;
                        echo $this->render('box/list_hot_news.phtml');
                        break;
                }//end switch
            ?>
            <!-- InstanceEndEditable -->
        </div>
    </div>
</div>